From: Florian Müllner Date: Thu, 12 Aug 2021 01:49:37 +0000 (+0200) Subject: appMenu: Update "new-window" item on state changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~103 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e3c06e3c77dbc5a52637bdb0162a123c30cce560;p=gnome-shell.git appMenu: Update "new-window" item on state changes Stopped apps can *always* open a new window, so before we start using the menu for non-running apps, make sure to hide the menu item as necessary. Part-of: --- diff --git a/js/ui/appMenu.js b/js/ui/appMenu.js index 7f25566e0..425faebb5 100644 --- a/js/ui/appMenu.js +++ b/js/ui/appMenu.js @@ -93,12 +93,19 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu { return; this._updateQuitItem(); + this._updateNewWindowItem(); } _updateQuitItem() { this._quitItem.visible = this._app?.state === Shell.AppState.RUNNING; } + _updateNewWindowItem() { + const actions = this._app?.appInfo?.list_actions() ?? []; + this._newWindowItem.visible = + this._app?.can_open_new_window() && !actions.includes('new-window'); + } + _updateDetailsVisibility() { const sw = this._appSystem.lookup_app('org.gnome.Software.desktop'); this._detailsItem.visible = sw !== null; @@ -164,9 +171,8 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu { }); }); - this._newWindowItem.visible = - app && app.can_open_new_window() && !actions.includes('new-window'); this._updateQuitItem(); + this._updateNewWindowItem(); } _queueUpdateWindowsSection() {